import 'package:star_author/utils/common_util/shared_preferences/sp_util.dart';
import 'package:star_author/utils/http/http_util.dart';
import 'package:carousel_slider/carousel_options.dart';
import 'package:flutter/material.dart';
// import 'package:fluwx/fluwx.dart';

class App {
  static GlobalKey<NavigatorState> materialKey = GlobalKey<NavigatorState>();

  static const String join_huiliu_key = "join_huiliu";

  static LinearGradient SHIMMER_GRADIENT = LinearGradient(
    colors: [
      Color(0xFFF5F5F5),
      Color(0xFFF0F0F0),
      Color(0xFFEEEEEE),
      Color(0xFFF2F2F2),
      Color(0xFFF8F8F8),
    ],
    stops: [
      0.0,
      0.3,
      0.5,
      0.7,
      1,
    ],
    begin: Alignment(-2.4, -0.2),
    end: Alignment(2.4, 0.2),
    tileMode: TileMode.clamp,
  );

  static String evaluation_text = "竞拍";

  static String evaluation_thumb = "";

  static String wechat_appId = "wx28067c340511924e";

  static String tell_phone = "400 075 5077";

  static bool auditing_version = false;

  static String appTitle = "";
  //
  static int seconds_for_copy_clipboard = 60;

  static getText({String replaceA: "", String replaceB: ""}) {
    if (evaluation_text.indexOf('标') != -1 && replaceA.isNotEmpty) {
      return replaceA + evaluation_text.split('')[1];
    } else if (!(evaluation_text.indexOf('标') != -1) && replaceB.isNotEmpty) {
      return replaceB;
    } else {
      return evaluation_text;
    }
  }

  //安卓下载地址
  static String android_download_url = "https://huiliu.net/app-release.apk";

  //IOS公测地址
  // static String ios_download_url = "https://testflight.apple.com/join/lSUYD6Ui";
  //iOS appstore地址
  static String ios_download_url =
      "https://apps.apple.com/cn/app/%E5%9B%9E%E6%B5%81/id1581519711";

  //公司

  // static String gaoDeAndroidKey = '3a825d2e99aa0646eeffeedd465b2e4e';
  //
  // static String gaoDeIosKey = '1974d49471f74e3480b9c464e9a521e0';

  //私人

  static String gaoDeAndroidKey = 'ec8afe954c1ae2fdb7a682e6f23073fc';

  static String gaoDeIosKey = '42268b3e098f10f93a547afcb274d132';

  static String preRouteName = ''; //登陆前的路由存放

  static String corpId = 'ww8425fce861c6c3fa'; //企业id

  static String miniProgramId = "gh_797d3bd8cbd1"; //小程序原始id

  static String customerServiceUrl = ''; //客服url

  static double gold_deducting_price = 0;

  static String shipped_time_description = "";

  static Map<String, dynamic> defaultClassify = {
    "gold_bar": 5,
    "gold_ornament": 8,
    "k_gold_ornament": 8,
  };

  static Map<String, dynamic> gold_deducting_price_for_classify =
      defaultClassify; //黄金手续费

  static String complaintsServiceUrl = ''; //投诉客服url

  // static String bidderKnow = "https://huiliu.net/bidder_known";//正式 买家须知
  static String bidderKnow =
      "${HttpUtil.getServerPath()}/bidder_known?nobtn=true";

  static String evaluatorKnown =
      "${HttpUtil.getServerPath()}/evaluator_known"; //测试

  // static String bidderKnow = "https://huiliu.net/bidder_known";//正式

  //回流买家协议
  static String bidderTerms = "${HttpUtil.getServerPath()}/bidder_terms"; //

  static String RefreshIndex = "RefreshIndex"; //通知首页刷新

  static String RefreshHomeMoney = "RefreshHomeMoney"; //通知首页出价刷新

  static String checkOverflow = "checkOverflow"; //tab刷新下标

  static String universalLink = "https://huiliu.net/about/";

  static String entryDev =
      "https://a7d59621aa224400a13e5d6fb203bb9f@sentry.huiliu.net/8";

  static String entryProd =
      "https://644d2a4c1131442e9396bf8507afa866@sentry.huiliu.net/9";

  static String entryAnchor =
      "https://3f728329924f4cccad80bc2ce7dfee45@sentry.huiliu.net/16";

  static String agree = "agree"; //app是否同意隐私政策

  static String copyTime = "copyTime"; //粘贴板读取时间间隔

  static String agreeTime = "agreeTime"; //上次不同意隐私政策的时候 应用宝48小时内不能在弹出来

  static const String uMengAndroidKey = "62cba48488ccdf4b7ec67d9d";

  static const String uMengIOSKey = "62cba4eb88ccdf4b7ec6804e";

  static const String uMengChannel = "Umeng";

  //小程序微信支付类型 根据运行环境区分
  // static WXMiniProgramType miniProgramType = WXMiniProgramType.RELEASE;

  //需要过滤的集合 不展示的
  static List filter_category = ['P', 'Y', 'Q', 'G'];

  static List filter_certificate = ['P', 'Q', 'G'];

  static List grouped_evaluate_price_range = [];

  static String wechat_gold_service_url = "";

  static String wechat_appraise_service_url = "";

  //出价弹框倒计时--多少s
  static int popover_wait_time = 3;

  //APP视频缓存目录
  static String mDir = "";

  //直播间已读的艾特消息key 已读的消息缓存在本地 下一次进来读取的时候 先判断本地是否有这个消息
  //每天进入APP 都清理上一天的弹幕消息缓存
  static String et_stream_key = "et_stream_key";

  //深色模式
  static String theme_key = "changed_theme_key";

  //阿里云缓存配置
  static Map ali_setting = {
    "mMaxSizeMB": 1024 * 5,

    ///缓存目录的最大占用空间
    "mMaxDurationS": 30,

    ///设置能够缓存的单个文件的最大时长
    "mDir": App.mDir,

    ///缓存目录
    "mEnable": true,

    ///是否开启缓存功能
  };

  static get isDark {
    return SpUtil.getBool(theme_key, defValue: false) ?? false;
  }

  //轮播图配置
  static CarouselOptions get AppCarouselOptions {
    return CarouselOptions(
      autoPlay: true,
      aspectRatio: 3 / 4,
      viewportFraction: 1,
      scrollDirection: Axis.vertical,
      autoPlayAnimationDuration: Duration(milliseconds: 1500),
      autoPlayCurve: Curves.easeInOutCubic,
    );
  }
}
